import React, {Component} from "react";
import {
	View,
	Text,
	Button,
	Vibration,
} from "react-native";

export default class VibrationExam extends Component {
	constructor(props) {
		super(props);
	}
	_onPress() {
		Vibration.vibrate([10, 500, 1000, 500], true) //10ms之后开始震动500ms，然后等待1000ms，再震动500ms；
	}
	_StopPress() {
		Vibration.cancel()
	}
	render() {
		return (
			<View> 
				<Button 
					title="震动"
					onPress={this._onPress}
				/>
				<Text>控制设备震动</Text>
				<Button 
					title="停止震动"
					onPress={this._StopPress}
				/>
			</View>
		);
	}
}
